<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class BooksPostRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'b_name' => 'required',
            'b_desc' => 'required',
            'type' => 'required',
            'pic' => 'image',

        ];
    }

    public function messages()
    {
        return [
            'b_name.required' => '书籍名称不能为空',
            'b_desc.required' => '书籍描述不能为空',
            'type.required' => '书籍分类不能为空',
            'pic.image' => '封面必须为图片文件',
        ];
    }
}
